# Maintainer: Daniel M. Capella <polyzen@archlinux.org>

pkgname=python-aiodns
pkgver=3.0.0
pkgrel=4
pkgdesc='Simple DNS resolver for asyncio'
arch=('any')
url=https://github.com/saghul/aiodns
license=('MIT')
depends=('python-pycares')
makedepends=('python-build' 'python-installer' 'python-wheel'
             'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/a/aiodns/aiodns-$pkgver.tar.gz")
sha256sums=('946bdfabe743fceeeb093c8a010f5d1645f708a241be849e17edfb0e49e08cd6')
b2sums=('2a3c61156069fa598df58191b35383da3e054396cdeb1bc8916cc0414bb6efc89d45789883a5b4f33e3a08a6ee544356b02d6c697c096deae3398f0ff4d3c316')

build() {
  cd aiodns-$pkgver
  python -m build --wheel --skip-dependency-check --no-isolation
}

# test_gethostbyaddr fails
#check() {
#  cd aiodns-$pkgver
#  python tests.py
#}

package() {
  cd aiodns-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/aiodns-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
